package main

import (
	"fmt"
)

func BinaryFind(arr *[6]int, leftIndex, rightIndex, findVal int) {
	if leftIndex > rightIndex {
		fmt.Println("未找到")
		return
	}

	midIndex := (leftIndex + rightIndex) / 2

	if findVal > (*arr)[midIndex] {
		BinaryFind(arr, midIndex+1, rightIndex, findVal)
	} else if findVal < (*arr)[midIndex] {
		BinaryFind(arr, leftIndex, midIndex-1, findVal)
	} else {
		fmt.Println("找到了，下标为", midIndex)
	}
}

func main() {
	arr := [6]int{1, 8, 10, 89, 1000, 1234}
	BinaryFind(&arr, 0, len(arr)-1, 8)
}
